import HttpRequestAPI from '@/services'
import type { VideoInfo } from '../home'

//TS 类型声明

/**
 * 视频详情类型
 */
// 用户行为类型
export interface UserInfoVO {
  userId: string
  nickName: string
  avatar: string
  sex: number
  personIntroduction: string
  noticeInfo: string
  grade: string
  birthday: string
  school: string
  fansCount: number
  focusCount: number
  likeCount: number
  playCount: number
  haveFocus: boolean
  theme: number
}

/**
 * 获取用户信息
 * @returns UserInfoVO
 */
export const userInfoHttpRequest = (userId: string) => {
  return HttpRequestAPI.get<UserInfoVO>({
    url: `/web/uHome/getUserInfo?userId=${userId}`
  })
}

/**
 * 取消关注用户
 * @returns null
 */
export const cancelFocusUserHttpRequest = (focusUserId: string) => {
  const data = new FormData()
  data.append('focusUserId', String(focusUserId))
  return HttpRequestAPI.post<null>({
    url: `/web/uHome/cancelFocusUser`,
    data
  })
}

/**
 * 关注用户
 * @returns null
 */
export const focusUserHttpRequest = (focusUserId: string) => {
  const data = new FormData()
  data.append('focusUserId', String(focusUserId))
  return HttpRequestAPI.post<null>({
    url: `/web/uHome/focusUser`,
    data
  })
}
